package edu.java.lectures.lec04.inheritance;

public class IsoscelesTriangle extends EquilateralTriangle {

    // --- Instance Variable ---------------------------------------------------

    // // bedro
    // private double a;

    // osnowa
    double b;

    // --- Constructors --------------------------------------------------------
    public IsoscelesTriangle(){
	
    }
    
    public IsoscelesTriangle(double a, double b) {
	this.a = a;
	this.b = b;
    }

    // --- Getters and Setters -------------------------------------------------

    // public double getA() {
    // return a;
    // }
    //
    // public void setA(double a) {
    // this.a = a;
    // }

    public double getB() {
	return b;
    }

    public void setB(double b) {
	this.b = b;
    }

    // --- Method --------------------------------------------------------------

    // overriding - predifining behaviour which is DECLARED in parent class
    @Override
    public double calculatePerimeter() {
	return 2 * a + b;
    }

    @Override
    public double calculateSurface() {
	double semiP = calculatePerimeter() / 2;
	double divident = semiP * (Math.pow((semiP - a), 2)) * (semiP - b);
	double result = Math.sqrt(divident);
	return result;
    }

    @Override
    public String toString() {
	System.out.println("catch me");
	return "(" + this.a + "," + this.b + ")";
    }
}
